﻿using Md.Api.Entity.DapperModels.MdDB;
using Md.Api.Model.Manage.MdAddress.Request;
using Md.Dapper.Repositories.Md;

namespace Md.Api.Service.Manage.MdAddress;
/// <summary>
/// 分页获取收货/发货地址列表服务
/// </summary>
public class GetMdAddressPageListService : ApiBase<RequestGetMdAddressPageListModel>
{
    /// <summary>
    /// 收货/发货地址仓储
    /// </summary>
    public MdAddressRep mdAddressRep { get; set; }
    /// <summary>
    /// 执行
    /// </summary>
    protected override void ExecuteMethod()
    {
        var model = new MdAddressModel();

        model.Name = Parameter.Name;
        model.Phone = Parameter.Phone;
        model.Email = Parameter.Email;
        model.Country = Parameter.Country;
        model.Province = Parameter.Province;
        model.City = Parameter.City;
        model.District = Parameter.District;
        model.ZipCode = Parameter.ZipCode;
        model.UserId = Parameter.UserId;
        model.AddressType = Parameter.AddressType;
        model.IsDefault = Parameter.IsDefault;
        model.Status = Parameter.Status;
        model.CreateBy = Parameter.CreateBy;
        model.UpdateBy = Parameter.UpdateBy;

        var res = mdAddressRep.GetMdAddressPageList(model, Parameter.PageIndex, Parameter.PageSize, Parameter.OrderBy, Parameter.IsDesc);

        Result.Data = res;
    }
}

